1. Field of the Invention
The present invention relates to computer science. More specifically the present invention relates to reusing style sheet assets.
2. Description of the Related Art
Cascading Style Sheets (CSS) is a programming language used to describe presentation semantics of a document written in a markup language. Common markup languages include hypertext markup language (HTML), which is currently the most popular language used to create web pages. Other example markup languages include Extensible Markup Language (XML) and HTML5.
The most common usage of CSS is to style web pages, although the style sheets can be applied to any document. CSS may be used to enable the separation of document content from document presentation, including elements such as the layout, color, and fonts. This separation often improves content accessibility, provides more flexibility and control in the specification of presentation characteristics, enables multiple pages to share formatting, and reduce complexity of the content by reducing repetition. CSS can also allow the same document to be presented in different styles for different rendering methods, such as on-screen, in print, by voice, etc.
When utilizing CSS, a web page may contain references to one or more CSS sources (files). During the process of displaying the web page, the processing entity (such as a web browser) retrieves the linked CSS files, extracts the style rules specified in the CSS files, and applies those rules to various places within the web document being displayed.
There are various ways in which a CSS style sheet can be included into a web page. The first is through a <LINK> tag within the <HEAD> section of the HTML document. For example:
 <HEAD> <LINK REL= “STYLESHEET” type=”text/css” href=http://www.example.com/stylel.css>...</HEAD>
Another way to include a CSS style sheet into a web page is through an “@import” statement within a <STYLE> element. For example:
 <!— @import url(http://www.example.com/style2.css);--></STYLE>
At the time of displaying a web page, the web browser (or other document processing program) performs the function of combining the style rules specified within CSS files and applying such rules to appropriate elements within the page being displayed. This process is performed separately for each page. This process can take up valuable computing power, which is especially critical as the devices running web pages become smaller and smaller (such as mobile phones), and have less CPU and battery power to spare for such operations.
While this process can be streamlined a bit by storing CSS style sheets in a cache as they are downloaded, negating the need to re-download CSS style sheets that are being reused, this solution helps largely with network bandwidth issues, and does not affect CPU or battery power issues, as the CSS style sheet must still be processed for each web page, regardless of where it is located.
What is needed is a solution that helps reduce CPU and battery power utilized to process CSS style sheets.